package com.qk.management.handler;


import com.qk.common.Result;
import com.qk.common.exception.CommonException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author:Shuna
 * @Date: 2025/10/07 9:25
 * @Description:
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public Result handleException(Exception e) {
        log.error("服务器异常:{}", e.getMessage());
        return Result.error("您的网络有问题,请稍后再试!");
    }

    @ExceptionHandler(CommonException.class)
    public Result handleException(CommonException e) {
        log.error("参数异常:{}", e.getMessage());
        return Result.error(e.getMessage());
    }
}
